
var prettyPrint = false, minify = true, optimize = true;

for (var i = 0; i < args.length; i++)
	switch (args[i]) {
		case 'pp':
			prettyPrint = true;
			break;
		case 'nominify':
			minify = false;
			break;
		case 'nooptimize':
			optimize = false;
			break;
	}

var list = [];	// the input files will be stored here

var require = function(filename) {
	list.push(filename);
}

eval(readFile('Alkaline.bootstrap.js'));
Alkaline.bootstrap(this);

var str = '';
for (var i = 0; i < list.length; i++)
	str += readFile(list[i]);

echo(str.length + ' characters total.');

eval(str);

var params = [];
// write output here:
params.push('-o', 'Alkaline-all.js');

if (optimize)
	params.push('-optimize');

if (minify)
	params.push('-minify');

if (prettyPrint)
	params.push('-pp');

echo('Compiling (' + params.join(', ') + ')...');

params = params.concat(list);

Alkaline.run(params);
